<template>
  <view :data-theme="cueTheme">
    <basic-components />
    <custom-navbar title="任务类型" right-icon="icon-xinzeng1" @right-click="pageSkip({}, basicFlag.ADD)" />

    <view class="basic-search-box">
      <template v-if="dataGrid.data.length">
        <view v-for="item of dataGrid.data" :key="item.id" class="table-box">
          <view class="table-row">
            <view class="left">
              <image class="image" :src="setImgUrl(item)" />
              <view class="left-value">
                <view>{{ item.dicValue }}</view>
              </view>
            </view>
            <view class="right f-center">
              <view>
                {{ item.statusName }}
              </view>
              <text>使用状态</text>
            </view>
          </view>
          <view class="buttons">
            <view v-if="item.status === 0" class=" iconfont icon-jinyong2" @tap="openDialog(item, basicFlag.DISABLE)" />
            <view v-if="item.status === 1" class=" iconfont icon-qiyong2" @tap="openDialog(item, basicFlag.ENABLE)" />
            <view class="edit iconfont icon-bianji" @tap="pageSkip(item, basicFlag.EDIT)" />
            <view class="del iconfont icon-shanchu1" @tap="openDialog(item, basicFlag.REMOVE)" />
          </view>
        </view>
      </template>
      <view v-else-if="dataGrid.loading !== 1" class="main-no-data">
        <image class="add-image" src="~@/static/img/add.png" @tap="pageSkip({}, basicFlag.ADD)" />
      </view>
    </view>

    <m-modal :visible.sync="dialogParams.visible" :content="dialogParams.content" :apis="dialogParams.apis"
      :use-flag="dialogParams.useFlag" :params="dialogParams.params" :select-row-data="dialogParams.selectRowData"
      @submit="search" />
  </view>
</template>

<script>
import { getFiles } from "@/utils/getFiles"
const files = require.context("./mixins", false, /\.js$/)
const mixins = getFiles(files)
import scroll from "@/common/mixins/scroll"

export default {
  mixins: [...mixins, scroll],
  onShow() {
    this.search()
  },
  data() {
    return {
      options: [
        {
          text: "编辑",
          style: {
            backgroundColor: this.$basicColor.warning_color
          }
        },
        {
          text: "删除",
          style: {
            backgroundColor: this.$basicColor.del_color
          }
        },
        {
          text: "启用",
          style: {
            backgroundColor: this.$basicColor.success_color
          }
        },
        {
          text: "禁用",
          style: {
            backgroundColor: this.$basicColor.del_color
          }
        }
      ]
    }
  }
}
</script>

<!-- <style lang="scss"  src="./index.scss"></style> -->

